package com.flower.droid;

import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.WindowManager;

public class FlowerDroidActivity extends Activity {
	
	private AsyncTask<Object, Object, Object> mLauncher;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);
        
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                WindowManager.LayoutParams.FLAG_FULLSCREEN );
        
    }
    
    @Override
    protected void onResume() {
    	super.onResume();
    	
    	mLauncher = new AsyncTask<Object, Object, Object>() {

			@Override
			protected Object doInBackground(Object... params) {
				try {
					Thread.sleep(2500);
				} catch(Exception e) {
					e.printStackTrace();
				}
				return null;
			}
			
			protected void onPostExecute(Object result) {
				if(!isCancelled()) {
					Intent intent = new Intent(FlowerDroidActivity.this, MainActivity.class);
					startActivity(intent);
					finish();
				}
			}
    		
    	};
    	mLauncher.execute(null, null);
    }
    
    @Override
    protected void onPause() {
    	super.onPause();
    	if(mLauncher != null) {
    		mLauncher.cancel(true);
    	}
    }
    
}